﻿package test.ui {
	import gear.core.Game;
	import gear.net.LibData;
	import gear.net.SWFLoader;
	import gear.ui.controls.GButton;
	import gear.ui.controls.GScrollBar;
	import gear.ui.controls.GToggleButton;
	import gear.ui.data.GButtonData;
	import gear.ui.data.GScrollBarData;
	import gear.ui.data.GToggleButtonData;
	import gear.ui.layout.GLayout;
	import gear.ui.monitor.LoadMonitor;
	import gear.ui.skin.LoadingSkin;

	import flash.events.Event;

	/**
	 * @version 20091215
	 * @author bright
	 */
	[SWF(width=1000,height=570,backgroundColor=0x333333,frameRate=48)]
	public class TestSkin extends Game {
		override protected function startup() : void {
			_res.add(new SWFLoader(new LibData("assets/ui.swf", "uiLib")));
			_res.addEventListener(Event.COMPLETE, completeHandler);
			_res.load();
		}

		private function completeHandler(event : Event) : void {
			var loading : LoadingSkin = new LoadingSkin();
			loading.x = 100;
			loading.y = 100;
			addChild(loading);
			loading.init();
			loading.showYou();
			// addProgressBar();
		}

		protected function addButton() : void {
			var data : GButtonData = new GButtonData();
			data.labelData.text = "按钮";
			addChild(new GButton(data));
		}

		protected function addToggleButton() : void {
			var data : GToggleButtonData = new GToggleButtonData();
			data.x = 10;
			data.y = 40;
			data.labelData.text = "选择按钮";
			data.selected = true;
			addChild(new GToggleButton(data));
		}

		protected function addScrollBar() : void {
			var data : GScrollBarData = new GScrollBarData();
			data.x = 200;
			data.y = 10;
			var sb : GScrollBar = new GScrollBar(data);
			sb.resetValue(10, 0, 10, 0);
			addChild(sb);
		}

		protected function addLoadMonitor() : void {
			var loadMotion : LoadMonitor = new LoadMonitor(this);
			loadMotion.show();
			GLayout.layout(loadMotion);
		}

		public function TestSkin() {
		}
	}
}
